
--create database yeti
--go

use yeti
go



--NA POTEM pole komentarz dla session i dla turnow

create table Subject
(
	ID_subject int primary key identity(1,1) not null,
	Name varchar(500) not null
);

create table Topic
(
	ID_topic int  primary key identity(1,1) not null,
	Name varchar(500) not null,
	ID_subject int foreign key  references Subject not null
);

create table Session
(
	ID_session int primary key identity(1,1) not null,
	Start_date datetime2 not null,
	End_date datetime2 not null,
	User_name varchar(500),
	User_IP varchar(500),
	State varchar(500),
	Reason varchar(max)
	

);


create table Pattern
(
	ID_pattern int primary key identity(1,1) not null,
	Content varchar(500) not null,
	User_input varchar(500),
	ID_topic int foreign key references Topic not null 	
);
create table Response
(
	ID_response int primary key identity(1,1) not null,
	Content varchar(500) not null,
	ID_pattern int foreign key references Pattern not null--,
	--Accuracy int not null,
	--Certainty int not null
);

create table Turn
(
	ID_turn int primary key identity(1,1) not null,
	ID_session int foreign key references Session not null,
	ID_pattern int foreign key references Pattern not null,
	ID_response int foreign key references Response not null,
	Datestamp datetime2 not null

);




